<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        layout:decorate="~{common/base}">
<!--公共CSS JS引用-->
<head th:include="/common/head :: commonHead('权限组管理')"></head>
<body>
<!--自定义的页面内容-->
<div layout:fragment="index">

    <!--自定义JS-->
    <script th:src="@{~/js/biz/dataTables.js}" th:inline="javascript" type="text/javascript"></script>
    <script th:src="@{~/js/biz/permissionGroup.js}" th:inline="javascript" type="text/javascript"></script>

    <script type="text/javascript">
        $(function () {
            DataTables.groupTable();
            PermissionGroup.initPermission();
            PermissionGroup.initMenu();
            PermissionGroup.initRole();
        });
    </script>

    <style type="text/css">
        table.dataTable tbody tr.selected {
            background-color: #b0bed9;
        }
    </style>

    <section class="content-header">
        <h1>
            系统管理
            <small>权限组管理</small>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box-widget">
                    <div class="box-header">
                        <h3 class="box-title">权限管理</h3>
                    </div>
                    <div class="box-body">
                        <div class="pull-left" style="width: 49%">
                            <div class="box box-widget">
                                <div class="box-header with-border">
                                    权限组
                                </div>
                                <div class="box-body">
                                    <button class="btn btn-default" onclick="PermissionGroup.showAddModal();"><i class='glyphicon glyphicon-new-window'>添加</i></button>
                                    <br>
                                    <br>
                                    <table id="groupTable" class="table table-bordered table-hover" style="width: 100%">

                                    </table>
                                </div>
                            </div>
                        </div>

                        <div class="pull-right" style="width: 49%">
                            <div class="box box-widget">
                                <div class="box-header with-border">
                                    <button class="btn btn-default pull-right" onclick="PermissionGroup.savePermission()">保存</button>
                                </div>
                                <div class="box-body">
                                    <div class="row">
                                        <div class="col-xs-12">
                                            <div class="col-xs-6">
                                                菜单
                                                <ul id="menuTree" class="ztree" style="border: 1px silver solid;"></ul>
                                            </div>
                                            <div class="col-xs-6">
                                                权限
                                                <ul id="permissionTree" class="ztree" style="border: 1px silver solid;"></ul>
                                            </div>

                                        </div>
                                    </div>

                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </section>

    <!--添加Modal-->
    <div class="modal fade" id="addGroup">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="PermissionGroup.formReset();">
                        <span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">添加权限组</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" id="groupForm">
                        <input id="id" name="id" type="hidden">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="groupName" class="col-sm-2 control-label">权限组</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" id="groupName" name="groupName" placeholder="请输入权限组名称">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="roles" class="col-sm-2 control-label">角色</label>
                                <div class="col-sm-10">
                                    <select class="form-control" id="roles" name="roles" multiple='multiple'>

                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="description" class="col-sm-2 control-label">描述</label>
                                <div class="col-sm-10">
                                    <textarea type="text" class="form-control" id="description" name="description" placeholder="请输入描述"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default pull-left" data-dismiss="modal" onclick="PermissionGroup.formReset();">关闭</button>
                    <button type="button" class="btn btn-primary" onclick="PermissionGroup.save()">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>